package com.xsp.entity;

import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;

/**
 * @author xsp
 * @date 2024/1/9
 * @desc
 */
@Data
@Component("person")
public class Person {
    public Person(Cat cat) {
        this.cat = cat;
    }

    public Person() {
        System.out.println("创建了Person对象");
    }

    // 家猫
    private Cat cat;

    @Autowired
    public void setCat(Cat cat) {
        this.cat = cat;
    }

    /**
     * 撸猫
     */
    public void luCat() {
        System.out.println("终于下班到家了，好累，撸撸猫减压。。");
        cat.purr();
    }

    public void speak() {
        System.out.println("xxx说话。。。。");
    }
}
